package com.jic.member.controller.manage;

import com.jic.member.api.rest.EventListenerProviderApi;
import com.jic.member.entity.model.EventListenerContent;
import com.jic.member.request.EventListenerInputDTO;
import com.jic.member.service.EventListenerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/eventListenerProviderApi")
@ResponseBody
@Slf4j
public class EventListenerProviderApiController implements EventListenerProviderApi {

    @Resource
    private EventListenerService eventListenerService;

    @Override
    public void processEvent(EventListenerInputDTO dto) {
        eventListenerService.processEvent(
                new EventListenerContent()
                        .setEventCode(dto.getEventCode())
                        .setEventType(dto.getEventType())
                        .setThirdUserId(dto.getThirdUserId())
                        .setParam(dto.getParam())
                        .setDeptType(dto.getDeptType())
                        .setDeptIds(dto.getDeptIds())
        );
    }
}
